<%--
  更新用户密码
--%>
<%@ page import="com.dsj.dao.CustomerDao" %>
<%@ page import="com.dsj.util.Encrypt" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>更新密码</title>
</head>
<body>
<%
    // 实例化 CustomerDao 对象
    CustomerDao customerDao = new CustomerDao();
    // 设置请求的字符编码为 utf-8
    request.setCharacterEncoding("utf-8");
    // 将请求参数中的 id 转换为 int 类型
    int id = Integer.parseInt(request.getParameter("id"));
    // 获取请求参数中的 password 并去除前后空格
    String password = request.getParameter("password").trim();
    // 对 password 进行加密处理
    password = Encrypt.encryptPassword(password);
    // 更新客户密码
    boolean flag = customerDao.updateCustomerPassword(password, id);
%>
<table width="1024" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
        <td colspan="2" height="100">
            <jsp:include   page="../common/head.jsp" flush="true" />
        </td>
    </tr>

    <tr>
        <td width="300" valign="top" bgcolor="#F5F5F5">
            <!--左侧01-->
            <jsp:include page="../common/left.jsp" flush="true" />
        </td>

        <td width="724" align="center" valign="top" bgcolor="#FFFFFF">

            <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#000000">
                <tr>
                    <td bgcolor="#FFFFFF" align="center">
                        <img src="<%= request.getContextPath()%>/images/systemImages/fg2.jpg" width="752" height="45">
                        <p><strong>
                            <%if(flag){%>
                                密码修改成功！！！
                            <%}else{%>
                                密码修改失败！！！
                            <%}%>
                        </strong></p>
                        <meta http-equiv="refresh" content="2;URL=../product/main.jsp">
                    </td>
                </tr>
            </table>

        </td>

    <tr>
        <td colspan="2"><jsp:include page="../common/statusBarNavigation.jsp"
                                     flush="true" />
        </td>
    </tr>
</table>
</body>
</html>
